/*jshint esversion: 6 */
import React from "react";
import ReactDom from "react-dom";
//applyMiddleware开启thunk中间件,compose对几个函数进行组合
import { createStore, applyMiddleware,compose } from "redux";
//thunk处理异步的任务
import thunk from "redux-thunk";
//连接任务
import {Provider} from "react-redux";
import App from "./App";
import {counter,addGun,removeGun,addGunAsync} from "./index.redux";

//创建一个任务
const store=createStore(counter,compose(
    applyMiddleware(thunk),
    window.devToolsExtension?window.devToolsExtension():f=>f //谷歌的redux插件的配置
))

ReactDom.render(
    (<Provider store={store}>
        <App />
    </Provider>),
        document.getElementById("root")
)

//监听状态
// store.subscribe(render)